﻿using System.Data;
using DataObject;

namespace Event.Controls.News
{
    public partial class OtherNews : System.Web.UI.UserControl
    {
        #region variables, constants, properties
        private const string LI_FORMAT = @"<li><a title=""{1}"" href=""{2}"">{0}</a></li>";
        #endregion

        internal bool DataBind(DataTable dt)
        {
            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var r = dt.Rows[i];

                    this.ltrList.Text += string.Format(LI_FORMAT,
                    r[Constants.Table_News.OtherNewsTitle],
                    r[Constants.Table_News.EncodeTitle],
                    r[Constants.Table_News.Url]);
                }
                return true;
            }
            return false;
        }
    }
}